package com.example.base.system.domain;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.base.system.service.SysLongtextService;
import com.example.base.utils.SpringContextUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author X.I.O
 * @since 2024-02-20
 */

@Data
@ApiModel(description = "")
@TableName("sys_job_record")
public class SysJobRecord implements Serializable {

    private static final long serialVersionUID = 1L;

        /**
    * 主键id
    */
    @TableId(value="id", type= IdType.AUTO)
    @ApiModelProperty(value = "主键id")
    private Integer id;
    /**
    * 任务id
    */
    @ApiModelProperty(value = "任务id")
    private Integer jobId;
    /**
    * 开始时间
    */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "开始时间")
    private Date startDate;
    /**
    * 结束时间
    */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "结束时间")
    private Date endDate;
    /**
    * 执行时间
    */
    @ApiModelProperty(value = "执行时间")
    private Integer execTime;
    /**
    * 执行结果
    */
    @ApiModelProperty(value = "执行结果")
    private Boolean resultStatus;
    /**
    * 创建时间
    */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createtime;
    /**
    * 更新时间
    */
    @ApiModelProperty(value = "更新时间")
    private Date updatetime;


    @ApiModelProperty(value = "长文本id")
    private Integer longtextId;

    @TableField(exist = false)
    private SysLongtext sysLongtext;

    public SysLongtext getSysLongtext() {
        if(this.longtextId!=null){
            SysLongtextService service=SpringContextUtils.getBean(SysLongtextService.class);
            SysLongtext sysLongtext=service.getById(this.longtextId);
            return sysLongtext;
        }
        return sysLongtext;
    }
}
